package cn.jwtool.jwcache.buffer.data.backup.impl;

import cn.jwtool.jwcache.buffer.data.backup.Serialization;
import com.alibaba.fastjson.JSON;

/**
 * @author : willian fu
 * @version : 1.0
 */
public class JsonSerialization implements Serialization {
    /**
     * 序列化成
     *
     * @param object
     * @return
     */
    @Override
    public byte[] serialization(Object object) {
        return JSON.toJSONBytes(object);
    }

    @Override
    public <T> T deserialization(byte[] data, Class<T> clazz) {
        return JSON.parseObject(data, clazz);
    }
}
